# Maintainer: Alexander F Rødseth <xyproto@archlinux.org>
# Contributor: Jared Casper <jaredcasper@gmail.com>
# Contributor: Paulo Matias <matias archlinux-br org>

pkgname=iverilog
pkgver=12.0
pkgrel=1
pkgdesc='Icarus Verilog compiler and simulation tool'
arch=('loong64' 'x86_64')
url='https://github.com/steveicarus/iverilog'
license=('GPL')
depends=('zlib' 'bzip2')
makedepends=('gperf' 'git')
options=('staticlibs')
source=("git+https://github.com/steveicarus/iverilog#tag=v${pkgver/./_}"
        fix-string-literal.patch::https://github.com/steveicarus/iverilog/commit/23e51ef7a8e8e4ba42208936e0a6a25901f58c65.patch)
md5sums=('SKIP'
         '35359d78199f3093b99436e1370249b3')

prepare() {
  cd "$pkgname"

  patch -Np1 < ../fix-string-literal.patch

  aclocal
  autoconf
}

build() {
  cd "$pkgname"

  CFLAGS+=' -ffat-lto-objects -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common

  CXXCPP=/usr/bin/cpp ./configure --prefix=/usr
  make
}

package() {
  make -C "$pkgname" -j1 prefix="$pkgdir/usr" install
}

# vim: ts=2 sw=2 et:
# getver: raw.githubusercontent.com/steveicarus/iverilog/master/scripts/MAKE_RELEASE.sh
